package com.caigou.modules.article.network.api

import com.caigou.comm.base.bean.CommentBean
import com.caigou.comm.base.bean.CommentItemBean
import com.caigou.comm.base.bean.HttpResult
import com.caigou.modules.article.bean.ArticleBean
import com.caigou.modules.article.bean.ArticleItemBean
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * @author #Suyghur.
 * Created on 2021/09/23
 */
interface HttpArticleApiService {

    @GET("/api/folk/data/info")
    fun getArticleInfo(@Query("currentUserId") userId: String, @Query("dataId") dataId: Int): Flow<HttpResult<ArticleItemBean>>

    @GET("/api/folk/data/my/list")
    fun getMyInfoList(
        @Query("page") page: Int, @Query("limit") limit: Int,
        @Query("userId") userId: String, @Query("checkStatus") checkStatus: Int
    ): Flow<HttpResult<ArticleBean>>

    @POST("/api/folk/data/like")
    fun setArticleLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/folk/data/collect")
    fun setArticleCollect(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @GET("/api/folk/data/reply/list")
    fun getCommentList(
        @Query("page") page: Int, @Query("limit") limit: Int,
        @Query("userId") userId: String, @Query("dataId") dataId: Int, @Query("sort") sort: Int
    ): Flow<HttpResult<CommentBean>>

    @GET("/api/folk/data/reply/detail")
    fun getCommentDetail(@Query("replyId") replyId: Int, @Query("dataId") dataId: Int, @Query("userId") userId: String): Flow<HttpResult<CommentItemBean>>

    @POST("/api/folk/data/reply/like")
    fun setCommentLike(@Body body: RequestBody, @Header("Content-type") header: String = "application/json;charset=utf-8"): Flow<HttpResult<String>>

    @POST("/api/folk/data/add/reply")
    fun setReply(@Body body: RequestBody): Flow<HttpResult<String>>
}